package com.ckzp.jfinal.system.validate;

import com.ckzp.jfinal.base.Validator;
import com.jfinal.core.Controller;

/**
 * Created by 51594 on 2023/6/7.
 */
public class SysTypeValidator extends Validator {

    /**
     * validate
     *
     * @param controller
     */
    protected void validate(Controller controller) {
        validateRequiredLength("type_code", 4, 20, "编号为4-20字符");
        validateRequiredString("type_name", "分类名不能为空");
        if (!isEdit()) validateFieldExit("sys_type", "type_code", "编号{1}已存在");
    }
}